<?php

namespace Maestros\Controller;

use Maestros\Controller\GenericController;

class MallaController extends GenericController {
    
    public function __construct() {
        
    }

    public function getList($id = 1, $param1 = 1, $param2 = 1, $param3 = 1) {
        $id = $this->params()->fromRoute('id');
        $param1 = $this->params()->fromRoute('param1');
        // obtener el limite de registros desde la url
        switch ($id) {
            case (0):
                $id = $this->params()->fromRoute('param1');
                $output = $this->getMallaService()->getRegistro($id);
                break;
            case (1):
                $id = $this->params()->fromRoute('param1');
                $output = $this->getMallaService()->getRegistroCompleto($id);
                break;
            case (2):
                $cedula = $this->params()->fromRoute('param1');
                $lapso = $this->params()->fromRoute('param2');
                $output = $this->getMallaService()->getMallasSegunCedulaYLapsoDeControlInscripcion($cedula, $lapso);
                break;
            default:
                return $param1;
        }
        return $this->convertirArrayAJson($output);
    }
}




